/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package toolz;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Bunkowski
 */
public class Misc {

public static void copy(String from, String to){
   InputStream in = null;
   OutputStream out = null;
   try {
      in = new FileInputStream(from);
      out = new FileOutputStream(to);
      int length = in.available(); // danger!
      byte[] bytes = new byte[length];
      in.read(bytes);
      out.write(bytes);
   }    catch (IOException ex) {
            Logger.getLogger(Misc.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
      if (in != null) {
                try {
                    in.close();
                } catch (IOException ex) {
                    Logger.getLogger(Misc.class.getName()).log(Level.SEVERE, null, ex);
                }
      }
      if (out != null) {
                try {
                    out.close();
                } catch (IOException ex) {
                    Logger.getLogger(Misc.class.getName()).log(Level.SEVERE, null, ex);
                }
      }
   }
}


}
